Breaks 您所在的位置:网站首页 endnotereference type Breaks

Breaks

2024-07-01 12:26| 来源: 网络整理| 查看: 265

Breaks¶

Word supports a variety of breaks that interrupt the flow of text in the document:

line break page break column break section break (new page, even page, odd page)

In addition, a page break can be forced by formatting a paragraph with the “page break before” setting.

This analysis is limited to line, page, and column breaks. A section break is implemented using a completely different set of elements and is covered separately.

Candidate protocol – run.add_break()¶

The following interactive session demonstrates the protocol for adding a page break:

>>> run = p.add_run() >>> run.breaks [] >>> run.add_break() # by default adds WD_BREAK.LINE >>> run.breaks [] >>> run.breaks[0].type.__name__ WD_BREAK.LINE >>> run.add_break(WD_BREAK.LINE) >>> run.breaks [, ] >>> run.add_break(WD_BREAK.PAGE) >>> run.add_break(WD_BREAK.COLUMN) >>> run.add_break(WD_BREAK.LINE_CLEAR_LEFT) >>> run.add_break(WD_BREAK.LINE_CLEAR_RIGHT) >>> run.add_break(WD_BREAK.TEXT_WRAPPING) Enumeration – WD_BREAK_TYPE¶ WD_BREAK.LINE WD_BREAK.LINE_CLEAR_LEFT WD_BREAK.LINE_CLEAR_RIGHT WD_BREAK.TEXT_WRAPPING (e.g. LINE_CLEAR_ALL) WD_BREAK.PAGE WD_BREAK.COLUMN WD_BREAK.SECTION_NEXT_PAGE WD_BREAK.SECTION_CONTINUOUS WD_BREAK.SECTION_EVEN_PAGE WD_BREAK.SECTION_ODD_PAGE Specimen XML¶ Line break¶

This XML is produced by Word after inserting a line feed with Shift-Enter:

Text before and after line break

Word loads this more straightforward generation just fine, although it changes it back on next save. I’m not sure of the advantage in creating a fresh run such that the element is the first child:

Text before and after line break Page break¶

Starting with this XML …

Before inserting a page break, the cursor was here } This was the following paragraph, the last in the document

… this XML is produced by Word on inserting a hard page:

Before inserting a page break, the cursor was here } This was the following paragraph, the last in the document

Word loads the following simplified form fine …

Text before an intra-run page break Text after an intra-run page break following paragraph

… although on saving it converts it to this:

Text before an intra-run page break Text after an intra-run page break following paragraph Schema excerpt¶ Resources¶ WdBreakType Enumeration on MSDN Range.InsertBreak Method (Word) on MSDN Relevant sections in the ISO Spec¶ 17.18.3 ST_BrClear (Line Break Text Wrapping Restart Location)


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有